-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pagination support and also support ?whereIn= in the query string #15
Open
nabilfreeman
wants to merge
26
commits into
mikec:master
Choose a base branch
from
lesalonapp:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update index.js
Add pagination in app.get for Collections
…ntally discard our where filtering
…s is bad practice because load and where are both optional so we should only put them in the URL if they are actually supplied.
…s cleaner because it's clear that where is one of many optional parameters.
Pagination breaks ?where query
nabilfreeman
changed the title
Pagination support
Pagination support and also support ?whereIn= in the query string
Oct 22, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey there, we got pagination working in a nice way. We mentioned we were working on it here: #14
In your query string, you can specify
?page=1&page_size=250
. The response will then be paginated to the first 250 results.We have hardcoded id to be descending, so it's always newest to oldest. Let us know if this is ok, there is currently no user ordering option in Kalamata.
If you leave
page
blank, nothing will happen. It's required.If you leave
page_size
blank, it will default to 100. Supplyingpage_size
withoutpage
will also do nothingIf you set
page_size
to 99999 or something greater than the total pages, it will just return the full list on one page.We took a leaf out of Wordpress
wp-json
's book for defining the next pages.In this example, we'll query our API with
/users?where={"type":"CUSTOMER"}&page=2&page_size=250
.In the response headers, you will get the following:
/users?where={"type":"CUSTOMER"}&page=3&page_size=250
/users?where={"type":"CUSTOMER"}&page=1&page_size=250
43
10610
When you reach the first or last page,
x-prev
orx-next
will be accordingly undefined. This is how you know you've reached the boundaries of the page list.Would appreciate any feedback. We also bumped the version to 0.2 as although everything should continue working as normal for existing people not using
?page=
there were some architecture changes and a new node module for query string manipulation.